﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Models;

public partial class Admin_shop_OrderUsedList : AdminBase
{
    public int _Id = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.CacheControl = "no-cache";
        if (!string.IsNullOrEmpty(Request.Params["ID"]))
        {
            _Id = int.Parse(HttpContext.Current.Request.QueryString["ID"]);

        }
        if (!Page.IsPostBack)
        {
            if (_Id != 0)
            {
                grdbind();
            }
        }
    }

    public void grdbind()
    {
        using (Entities bll = new Entities())
        {
            var Bpl = bll.S_Ordered.Where(p => p.OrderId == _Id);
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = Bpl.ToList();
            pds.AllowPaging = true;
            AspNetPager1.RecordCount = Bpl.Count(); //记录总数；
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize = AspNetPager1.PageSize;
            this.rptList.DataSource = pds;
            this.rptList.DataBind();
        }
    }
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {   //当页面页数改变时，执行这个方法；
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        grdbind();
    }
}